
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>系统登录</title>
</head>
<body>
<form action="/login" method="post">
    用户名:<input type="text" placeholder="请输入用户名" name="username"><br>
    密码：<input type="password" placeholder="请输入密码" name="password"><br>
    验证码：<input type="text" name="captcha"><br>
    <img id="d" src="/v1/cap/"  onclick="refreshImage(this)">
    <input  type="submit"  value="登录"/>
</form>
</body>
<script>
    function refreshImage(imgElement) {
        // 获取当前时间戳
        const timestamp = Date.now();

        // 重新请求相同的URL，加上时间戳参数
        const newSrc = `/v1/cap/?timestamp=${timestamp}`;

        fetch(newSrc)
            .then(response => {
                if (!response.ok) {
                    throw new Error('Network response was not ok');
                }
                return response.blob(); // 将响应转换为Blob对象
            })
            .then(blob => {
                // 创建一个新的URL对象
                const imageUrl = URL.createObjectURL(blob);
                // 更新图片的src属性
                imgElement.src = imageUrl;
            })
            .catch(error => console.error('Error refreshing image:', error));
    }




</script>
</html>